﻿using System;
using System.Globalization;
using System.Windows.Forms;

namespace DemoClectionGeneric
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnbegin_Click(object sender, EventArgs e)
        {
            var ps = new PhanSo<int> {TuSo = 3, MauSo = 4};
            var ps2 = new PhanSo<double> {TuSo = 3.4, MauSo = 4.2};
            var ps3 = new PhanSo<string> {TuSo = "A", MauSo = "B"};
            var ps4 = new PhanSo<bool> { TuSo = true, MauSo = false };
            var ps5 = new PhanSo<DateTime> { TuSo = DateTime.Now, MauSo = DateTime.Now };

            label1.Text = ps.Get(1).ToString(CultureInfo.InvariantCulture) + " - kieu int";
            label2.Text = ps.Get(1.1).ToString(CultureInfo.InvariantCulture) + " - kieu double"; ;
            label3.Text = ps.Get("khanh").ToString(CultureInfo.InvariantCulture) + " - kieu sring"; ;
            label4.Text = ps.Get(true).ToString(CultureInfo.InvariantCulture) + " - kieu bool"; ;
            label5.Text = ps.Get(DateTime.Now).ToString(CultureInfo.InvariantCulture) + " - kieu datetime"; ;
            MessageBox.Show(ps + "\n" + ps2 + "\n" + ps3 + "\n" + ps4 + "\n" + ps5);

            label1.Text = null;
            label2.Text = null;
            label3.Text = null;
            label4.Text = null;
            label5.Text = null;
        }
    }
}
